<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>回答问题</title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <script src="static/sool/js/global.js"></script>
    <script src="static/sool/js/similarQuestion.js"></script>
    <script src="static/sool/js/jquery.js"></script>
    <script src="static/js/amazeui.min.js"></script>
    <script src="static/js/handlebars.min.js"></script>
    <script>
        JsAndCssUtil.importCss("/static/css/amazeui.min");
        JsAndCssUtil.importCss("/static/css/font-awesome");
        JsAndCssUtil.importCss("/static/css/font-glyphicons");
        JsAndCssUtil.importCss("/static/sool/style/basic");
        JsAndCssUtil.importCss("/static/sool/style/detailQuestionUnansweredVistor");
        JsAndCssUtil.importCss("/static/sool/style/commitQuestion");
        JsAndCssUtil.importCss("/static/sool/style/similaryQuestion");
        JsAndCssUtil.importCss("/static/sool/style/mainQuestion");
        JsAndCssUtil.importCss("/static/sool/umeditor/themes/default/css/umeditor");
        JsAndCssUtil.importCss("/static/sool/uploadify/uploadify");

    </script>
</head>

<body>

<!--头部logo与我要提问的显示-->
<div id="ContainerId">
    <script type="text/javascript">
        renderNavBar();
    </script>
</div>

<div class="dq-frame am-animation-scale-down">
    <div class="dq-frame-left">
        <!--加载模板内的内容-->
        <div id="left_info_div">

        </div>
        <form id="firstAnswerInfo">
            <div class="dq-frame-left-editor-block" id="submitQuestion">
                我要回答：
                <script type="text/plain" name="solution" id="contentEditor" style="width:100%;height:240px;"></script>

                <a href="javascript:getUpload();">
                    <i class="fa fa-paperclip"></i>
                    上传附件
                </a>
                <div class="uploadDisplay">
                    <div id="queue"></div>
                    <input id="file_upload" name="file_upload" type="file">
                    <a href="javascript:$('#file_upload').uploadify('upload','*')">上传</a>
                    <a href="javascript:$('#file_upload').uploadify('cancel')">取消</a>
                    <div id="oldfilename"></div>
                    <input id="old_fileName" name="old_fileName" type="hidden">
                    <input id="new_file_url" name="new_file_url" type="hidden">
                </div>

                <div class="dq-frame-left-commit">
                    <button type="submit" class="am-btn am-btn-primary am-btn-sm" id="submitButton">
                        <i class="am-icon-check"></i>发送
                    </button>
                </div>
            </div>
        </form>
    </div>
    <!--相似问题-->
    <div class="dq-frame-right doc-similary-style" id="question_info">
        <script type="text/javascript">
            $(function(){
                getSimilarQuestion();
            });
        </script>
    </div>
    <div class="clearFloat"></div>
</div>

<!--修改补充问题的弹框-->
<!--覆盖框-->
<div id="covered">

</div>
<!--弹出框-->
<div class="am-g am-container updataMessage" id="poplayer">
    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">

        <div class="am-u-lg-10">
            <h3 class="am-margin-top-2"><a>为了您能更好的帮助别人，请填写下面信息</a></h3>
            <hr>
        </div>

        <div class="am-u-lg-2">
            <button class="doc-color-location doc-close">
                <span class="am-close am-icon-times"></span>
            </button>
        </div>
        <div class="am-u-lg-12">
            <div class="am-input-group am-input-group-default">
                <span class="am-input-group-label"><i class="am-icon-user"></i></span>
                <input id="user-name" type="text" class="am-form-field" placeholder="请输入您的姓名">
            </div>
            <div id="usename_info" style="color: red; margin-left: 50px; display: none">请输入提示信息</div>
            <br>
            <div class="am-input-group am-input-group-default">
                <span class="am-input-group-label">
                    <i class="am-icon-phone"></i>
                </span>
                <input id="user-phone" type="text" class="am-form-field" placeholder="请输入您的电话号码">
            </div>
            <div id="user-phone_info" style="color: red; margin-left: 50px; display: none;">请输入提示信息</div>
            <br>
            <div class="am-input-group am-input-group-default">
                <span class="am-input-group-label">
                    <i class="am-icon-envelope"></i>
                </span>
                <input id="user-email" type="text" class="am-form-field" placeholder="请输入您的电子邮箱">
            </div>
            <div id="user-email_info" style="color: red; margin-left: 50px; display: none">请输入提示信息</div>
            <hr>
            <button id="saveInfo" type="button" class="am-btn am-btn-success doc-saveInfo">保存信息</button>
            <p></p>
            <p></p>
        </div>
    </div>
</div>

<!--底部版权模块-->
<footer class="am-margin-top doc-footer-color">
    <hr/>
    <p class="am-text-center">
        <small>
            @copy;2015用友能源科技有限公司版权所有 京ICP备15038140号-1   官方微博   用户协议
        </small>
    </p>
</footer>


<script type="text/javascript">
    //插件文件
    JsAndCssUtil.importJs("/static/sool/js/jquery");
    JsAndCssUtil.importJs("/static/js/amazeui.min");
    JsAndCssUtil.importJs("/static/js/handlebars.min");

    /*加载logo和NAV和search*/
    JsAndCssUtil.importJs("/static/sool/js/nav");

    /*加载引入公共的useID的文件*/
    JsAndCssUtil.importJs("/static/sool/data/bindingData");

    //提交form要用的js
    JsAndCssUtil.importJs("/static/sool/js/jquery.form");

    //验证表单的js文件
    JsAndCssUtil.importJs("/static/sool/data/commitQuestion");

    //自己的js文件
    JsAndCssUtil.importJs("/static/sool/data/detailQuestionUnansweredVistor");

    //umeditor所需文件
    JsAndCssUtil.importJs("/static/sool/umeditor/umeditor.min");
    JsAndCssUtil.importJs("/static/sool/umeditor/lang/zh-cn/zh-cn");
    JsAndCssUtil.importJs("/static/sool/umeditor/publish.umeditor.config");
    <!--导入-->
    JsAndCssUtil.importJs("/static/sool/uploadify/jquery.uploadify.min");
    JsAndCssUtil.importJs("/static/sool/uploadify/uploadfile");

</script>

<!--[if lt IE 9]>
<script>
    JsAndCssUtil.importJs("/static/js/modernizr-2010.07.16dev");
    JsAndCssUtil.importJs("/static/js/amazeui.ie8polyfill.min");
</script>
<![endif]-->


<script type="text/javascript">
    var contentEditorUM = UM.getEditor('contentEditor');
    $("#submitButton").click(function(){
        //提交我的答案
        submitAnswer();
    });
</script>
<!--总体的模板-->
<script type="text/x-handlebars-template" id="handling-template">
    {{#with resultData}}
    <div class="dq-frame-left-question">

        <div class="doc-question-title-left">
            <img src="{{imgUrl pk_sool_user}}" alt="" height="68px" width="68px">
        </div>

        <div class="doc-question-title-right">
            <h3 class="dq-frame-left-question-title">
                <i class="fa fa-star am-text-danger"></i>&nbsp;{{question_title}}
            </h3>
            <div class="doc-question-title-right-bottom">
                <span class="dq-frame-left-question-username">
                    <i class="fa fa-user dq-icon-color"></i>
                    <a href="javascript:;">{{sool_username}}</a>
                </span>
                <span class="dq-frame-left-question-readnum">
                    <i class="fa fa-comments dq-icon-color"></i>
                    {{answercount}}&nbsp;回答
                </span>
                <span class="dq-frame-left-question-date">
                    <i class="fa fa-clock-o dq-icon-color"></i>
                    {{submissiontime}}
                </span>
            </div>
        </div>
        <div class="dq-frame-left-question-info">
            {{{description}}}
            {{#if new_file_url}}
            <br>
            <a href="{{new_file_url}}">
                <i class="fa fa-paperclip"></i>
                下载附件 : {{old_fileName}}
            </a>
            {{/if}}
        </div>
    </div>
    <div class="dq-frame-left-answer" id="answerDetail">
        <div class="dq-frame-left-answer-remind">
            <img src="static/images/others.png" alt="" height="25px" width="25px">
            雷锋们的答复:
        </div>
        {{#if smartQuestionAnswerList}}
        {{#with smartQuestionAnswerList}}
        {{#each this}}
        <div class="dq-frame-left-answer-detail" >
            <div class="doc-icon-location">
                <img src="{{imgUrl pk_answer_sool_user}}" alt="" width="40px" height="40px">
            </div>
            <div class="doc-detail-location">
                <div class="dq-frame-left-answer-detail-solver">
                    {{#transtype usertype}}
                    <i class="fa fa-user dq-icon-color"></i>
                    <a href="javascript:;">{{sool_username}}</a>
                    {{else}}
                    <i class="fa fa-user dq-icon-color2"></i>
                    <a href="javascript:;">运维人员</a>
                    {{/transtype}}
                </div>
                <div class="dq-frame-left-answer-detail-date">
                    <i class="fa fa-clock-o dq-icon-color doc-time-color"></i>&nbsp;{{recoverytime}}</div>
                <div  class="doc-containeQuestion">
                    <h4>{{{answer_farther}}}</h4>
                        {{#if new_file_url}}
                        <br>
                        <a href="{{new_file_url}}">
                            <i class="fa fa-paperclip"></i>
                            下载附件 : {{old_fileName}}
                        </a>
                        {{/if}}
                    {{#if list}}
                    {{#with list}}
                    {{#each this}}
                    {{#if question_son}}
                    <div><span style="color:red">追问：</span>
                        {{{question_son}}}
                        {{#if question_new_file_url}}
                        <br>
                        <a href="{{question_new_file_url}}">
                            <i class="fa fa-paperclip"></i>
                            下载附件 : {{question_old_fileName}}
                        </a>
                        {{/if}}
                    </div>
                    {{/if}}
                    {{#if answer_son}}
                    <div><span style="color:green">追答：</span>
                        {{{answer_son}}}
                        {{#if answer_new_file_url}}
                        <br>
                        <a href="{{answer_new_file_url}}">
                            <i class="fa fa-paperclip"></i>
                            下载附件 : {{answer_old_fileName}}
                        </a>
                        {{/if}}
                    </div>
                    {{/if}}
                    {{/each}}
                    {{/with}}
                    {{/if}}
					<div class="clearFloat"></div>
                </div> 
            </div>
        </div>
        {{/each}}
        {{/with}}
        {{/if}}
    </div>
    {{/with}}
</script>

<!--相似问题的模板-->
<script type="text/javascript">
    loadSimilaryQuestion();
</script>


<!--追加我的回答模板-->
<script type="text/x-handlebars-template" id="addMyAnswer">
    {{#with resultData}}
    <div class="dq-frame-left-answer-detail">
        <div class="doc-icon-location">
            <img src="{{imgUrl pk_answer_sool_user}}" alt="" width="40px" height="40px">
        </div>
        <div class="dq-frame-left-answer-detail-solver">
            {{#transtype usertype}}
            <i class="fa fa-user dq-icon-color"></i>&nbsp;{{sool_username}}
            {{else}}
            <i class="fa fa-user dq-icon-color2"></i>&nbsp;运维人员
            {{/transtype}}
        </div>
        <div class="dq-frame-left-answer-detail-date"><i class="fa fa-clock-o dq-icon-color"></i>&nbsp;{{recoverytime}}</div>
        <div>
            {{{solution}}}

        </div>
        <div class="clearFloat"></div>
    </div>
    {{/with}}
</script>

<script type="text/javascript">
    getinfo();

    //搜索按钮
    searchClick();

    $(document).ready(function(){
        /*点击关闭按钮关闭弹框*/
        $("#poplayer").on("click",".doc-close",function(){
            $("#poplayer").hide();
            $("#covered").hide();
            return false;
        });

        /*点击保存信息触发*/
        $("#poplayer").on("click","#saveInfo",function(){
            /*邮箱的合法验证*/
            var email_reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
            var email_val = $("#user-email").val().trim();
            /*判断用户名合法*/
            if($("#user-name").val().trim() == ""){
                $("#usename_info").show();
                $("#usename_info").text("用户名不能为空");
                return false;
            }else
            /*判断电话号码*/
            if($("#user-phone").val().trim() == ""){
                $("#user-phone_info").show();
                $("#user-phone_info").text("电话号码不能为空");
                return false;
            }
            /*判断电子邮件*/
            if($("#user-email").val().trim() == ""){
                $("#user-email_info").show();
                $("#user-email_info").text("电子邮件不能为空");
                return false;
            }else if(email_reg.test(email_val) == false){
                $("#user-email_info").show();
                $("#user-email_info").text("邮箱格式不正确");
                return false;
            }

            /*验证用户信息提交*/
            updataUserInfo();
        });
    });


    //判断搜索到的相似问题是否为精华问题
    Handlebars.registerHelper("isEssenceQuestion", function(essence, options){
        if(essence == 0){
            return options.fn(this);
        }else{
            return options.inverse(this);
        }
    });
</script>

</body>
</html>